/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tk.eigh.ksvg.types;

import java.util.logging.Logger;
import tk.eigh.ksvg.SVGException;

/**
 *
 * @author nt
 */
final class SVGInteger {

    private final static char PLUS_SIGN = '+';
    protected final static Logger LOGGER = Logger.getLogger(SVGInteger.class.getName());

    protected static long parseText(String text) throws SVGException {
        try {
            return Long.parseLong(text);
        } catch (NumberFormatException ex1) {
            if (text.charAt(0) == PLUS_SIGN) {
                try {
                    return Long.parseLong(text.substring(1));
                } catch (NumberFormatException ex2) {
                    throw new SVGException(ex2);
                }
            } else {
                throw new SVGException(ex1);
            }
        }
    }
}
